package com.hmy.pig.service.impl;

import com.hmy.pig.domain.HmyPigLive;
import com.hmy.pig.domain.HmyPigPregnancy;
import com.hmy.pig.mapper.PigPregnancyMapper;
import com.hmy.pig.service.PigPregnancyService;
import com.hmy.staff.domain.HmyStaff;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhl
 * @descript 描述 猪只配种 业务层 实现类
 * @date 2024-01-29
 */

@Service
public class PigPregnancyServiceImpl implements PigPregnancyService {
    @Resource
    private PigPregnancyMapper pigPregnancyMapper;

    /**
     * 根据条件分页查询猪只分娩记录列表:  条件 母猪耳号、妊检类型、妊检负责人、妊检时间
     *
     * @param pigCode 猪只耳号
     * @param pregnancyTestType 妊检方式
     * @param pregnancyTestManager 妊检负责人
     * @param pigPregnancyDatetimeStart 妊检 开始时间
     * @param pigPregnancyDatetimeEnd 妊检结束时间
     * @return 猪只信息集合信息
     */
    @Override
    public List<HmyPigPregnancy> selectPigPregnancyList(String pigCode,
                                              Integer pregnancyTestType,
                                              String pregnancyTestManager,
                                              String pigPregnancyDatetimeStart,
                                              String pigPregnancyDatetimeEnd) {
        return pigPregnancyMapper.selectPigPregnancyList(pigCode,
                pregnancyTestType,
                pregnancyTestManager,
                pigPregnancyDatetimeStart,
                pigPregnancyDatetimeEnd);
    }

    /**
     * @param hmyPigPregnancy
     * @return java.util.List<com.hmy.pig.domain.HmyPigPrenancy>
     * @author ZHL
     * @date 2024/1/31 15:27
     * @description  添加猪只妊娠记录信息
     */
    @Override
    public int insertPigPregnancy(HmyPigPregnancy hmyPigPregnancy) {
        int rows = pigPregnancyMapper.insertPigPregnancy(hmyPigPregnancy);
        return rows;
    }
   /**
    * @param pregnancyId
    * @return com.hmy.pig.domain.HmyPigPrenancy
    * @author ZHL
    * @date 2024/1/31 15:28
    * @description 根据母猪耳号查询 猪只妊娠记录信息
    */
    @Override
    public HmyPigPregnancy selectPigPregnancyByPregnancyId(Long pregnancyId) {
        return pigPregnancyMapper.selectPigPrenancyByPregnancyId(pregnancyId);
    }
    /**
     * @param hmyPigPregnancy
     * @return java.util.List<com.hmy.pig.domain.HmyPigPrenancy>
     * @author ZHL
     * @date 2024/1/31 15:27
     * @description 修改猪只妊娠记录信息
     */
    @Override
    public int updatePigPregnancy(HmyPigPregnancy hmyPigPregnancy) {
        return pigPregnancyMapper.updatePigPregnancy(hmyPigPregnancy);
    }


    /**
     * @param pregnancyId
     * @return int
     * @author ZHL
     * @date 2024/1/31 15:28
     * @description 删除 根据妊娠id猪只妊娠记录信息
     */
    @Override
    public int deletePigPregnancyByPregnancyId(Long pregnancyId) {
        return pigPregnancyMapper.deletePigPregnancyByPregnancyId(pregnancyId);
    }
    /**
     * @param prenancyIds
     * @return int
     * @author ZHL
     * @date 2024/1/31 15:28
     * @description 批量删除猪只妊娠记录信息
     */
    @Override
    public int deletePigPregnancyByPregnancyIds(Long[] prenancyIds) {
        return pigPregnancyMapper.deletePigPregnancyByPregnancyIds(prenancyIds);
    }

    @Override
    public List<HmyStaff> findAllStaffName() {
        return pigPregnancyMapper.findAllStaffName();
    }
}
